<template>
    <div class="hhh">
        <h1 class="trf">登录页</h1>
        <!-- <el-button type="primary" @click="superLogin">123登录(超管)</el-button>
        <el-button @click="normalLogin">456登录(普管)</el-button> -->
        <el-form :inline="true">
            <el-form-item style="margin-top:20px;" label="账号">
                <el-input style="width: 200px;" placeholder="请输入账号"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input style="width: 200px;" placeholder="请输入密码"></el-input>
            </el-form-item>
            <el-form-item>

                <el-button type="primary" @click="superLogin">登录1</el-button>
                <el-button type="primary" @click="normalLogin">登录2</el-button>
            </el-form-item>

        </el-form>
    </div>
</template>

<script setup lang="ts">
import api from '@/api';
import { ElMessage } from 'element-plus';
import { useRouter } from 'vue-router';
const router = useRouter();
const superLogin = async () => {
    const res = await api.admins.login({
        account: '867229',
        password: '666',
    })
    // console.log(res);
    if (res.code == 200) {
        ElMessage.success('登录成功');
        localStorage.user_token = res.token;
        router.push('/');
    }

}

const normalLogin = async () => {
    const res = await api.admins.login({
        account: '1234567890',
        password: '0987654321',
    })
    console.log(res);
    if (res.code == 200) {
        ElMessage.success('登录成功');
        localStorage.user_token = res.token;
        router.replace('/');
    }
}


</script>

<style lang="scss" scoped>
.hhh {
    width: 300px;
    height: 300px;
    // background-color: aqua;
    border: 1px solid gainsboro;
    margin: auto;
    text-align: center;

    // background-color:gainsboro;
    .trf {
        width: 200px;
        height: 80px;
      
        margin: auto;
        //    line-height: 80px;
    }
}
</style>